package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllTeachers", query = "select myTeacher from Teacher myTeacher"),
		@NamedQuery(name = "findTeacherByAccount", query = "select myTeacher from Teacher myTeacher where myTeacher.account = ?1"),
		@NamedQuery(name = "findTeacherByAccountContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.account like ?1"),
		@NamedQuery(name = "findTeacherByBanjiId", query = "select myTeacher from Teacher myTeacher where myTeacher.banjiId = ?1"),
		@NamedQuery(name = "findTeacherByBanjiIdContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.banjiId like ?1"),
		@NamedQuery(name = "findTeacherByCourseRole", query = "select myTeacher from Teacher myTeacher where myTeacher.courseRole = ?1"),
		@NamedQuery(name = "findTeacherByCourseRoleContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.courseRole like ?1"),
		@NamedQuery(name = "findTeacherByImgUrl", query = "select myTeacher from Teacher myTeacher where myTeacher.imgUrl = ?1"),
		@NamedQuery(name = "findTeacherByImgUrlContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.imgUrl like ?1"),
		@NamedQuery(name = "findTeacherByName", query = "select myTeacher from Teacher myTeacher where myTeacher.name = ?1"),
		@NamedQuery(name = "findTeacherByNameContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.name like ?1"),
		@NamedQuery(name = "findTeacherByPassword", query = "select myTeacher from Teacher myTeacher where myTeacher.password = ?1"),
		@NamedQuery(name = "findTeacherByPasswordContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.password like ?1"),
		@NamedQuery(name = "findTeacherByPhone", query = "select myTeacher from Teacher myTeacher where myTeacher.phone = ?1"),
		@NamedQuery(name = "findTeacherByPhoneContaining", query = "select myTeacher from Teacher myTeacher where myTeacher.phone like ?1"),
		@NamedQuery(name = "findTeacherByPrimaryKey", query = "select myTeacher from Teacher myTeacher where myTeacher.phone = ?1") })
@Table(catalog = "baobaodb", name = "teacher")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "Teacher")
public class Teacher implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "phone", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String phone;
	/**
	 */

	@Column(name = "name", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;
	/**
	 */

	@Column(name = "account", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String account;
	/**
	 */

	@Column(name = "password", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String password;
	/**
	 */

	@Column(name = "banji_id", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String banjiId;
	/**
	 */

	@Column(name = "img_url", length = 20000)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String imgUrl;
	/**
	 */

	@Column(name = "course_role", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String courseRole;

	/**
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 */
	public String getPhone() {
		return this.phone;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setAccount(String account) {
		this.account = account;
	}

	/**
	 */
	public String getAccount() {
		return this.account;
	}

	/**
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 */
	public String getPassword() {
		return this.password;
	}

	/**
	 */
	public void setBanjiId(String banjiId) {
		this.banjiId = banjiId;
	}

	/**
	 */
	public String getBanjiId() {
		return this.banjiId;
	}

	/**
	 */
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	/**
	 */
	public String getImgUrl() {
		return this.imgUrl;
	}

	/**
	 */
	public void setCourseRole(String courseRole) {
		this.courseRole = courseRole;
	}

	/**
	 */
	public String getCourseRole() {
		return this.courseRole;
	}

	/**
	 */
	public Teacher() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Teacher that) {
		setPhone(that.getPhone());
		setName(that.getName());
		setAccount(that.getAccount());
		setPassword(that.getPassword());
		setBanjiId(that.getBanjiId());
		setImgUrl(that.getImgUrl());
		setCourseRole(that.getCourseRole());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("phone=[").append(phone).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("account=[").append(account).append("] ");
		buffer.append("password=[").append(password).append("] ");
		buffer.append("banjiId=[").append(banjiId).append("] ");
		buffer.append("imgUrl=[").append(imgUrl).append("] ");
		buffer.append("courseRole=[").append(courseRole).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((phone == null) ? 0 : phone.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Teacher))
			return false;
		Teacher equalCheck = (Teacher) obj;
		if ((phone == null && equalCheck.phone != null) || (phone != null && equalCheck.phone == null))
			return false;
		if (phone != null && !phone.equals(equalCheck.phone))
			return false;
		return true;
	}
}
